/**
 *       Copyright (c) 2012 Lukas Zaruba
 *
 *   This file is part of Robot Playground.
 *
 *   Robot Playground is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Robot Playground is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Lesser General Public License for more details.
 *
 *   You should have received a copy of the GNU Lesser General Public License
 *   along with Robot Playground. If not, see <http://www.gnu.org/licenses/>.
 */
package net.zarubsys.robotplayground.scripting2d;

/**
 * Node2D
 *
 * @author Lukas Zaruba, lukas.zaruba@gmail.com
 */
public class Node2D {
	
	private final int x;
	private final int y;
	private final Node2D origin;
	
	public Node2D(int x, int y, Node2D origin) {
		this.x = x;
		this.y = y;
		this.origin = origin;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}
	
	public Node2D getOrigin() {
		return origin;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Node2D)) return false;
		Node2D other = (Node2D) obj;
		return this.x == other.x && this.y == other.y;  
	}
	
	@Override
	public int hashCode() {
		return 13 + 19 * x + 23 * y;
	}
	
	@Override
	public String toString() {
		return "x=" + x + ", y=" + y + ";";
	}
	
}

